package com.android.functionmanagement.globle;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

import com.android.functionmanagement.entities.CommandInfo;

/**
 * 换成命令
 * 
 * @author fmh
 * @param <T>
 * 
 */
public class CacheCommand {

	public static BlockingQueue<CommandInfo> commands = new LinkedBlockingQueue<CommandInfo>();

	public static void push(CommandInfo object) {
		try {
			commands.put(object);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	// 移除栈顶
	public static CommandInfo take() {
		try {
			return commands.take();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		return null;
	}

	// 移除
	public static void remove(CommandInfo object) {
		commands.remove(object);
	}

	// 查看栈顶
	public static CommandInfo peek() {
		return commands.peek();
	}
}
